//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    weather: { 'wea_img': 'qing'},
    weatherweek:[],
    dflag: true,
    dzindex:1,
    izindex:0
  },
  onLoad: function () {
    var animation = wx.createAnimation({
      duration: 0,
      timingFunction: 'ease'
    });
    animation.opacity(0).step();
    this.setData({
      searchani:  animation.export()
    })
    this.weatherweekday();
  },
  onReady:function(){
   
  },
  closeinput:function(){
    this.setData({
      dflag:true,
      izindex:-1,
      dzindex:1
    })
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    });
    var animation1 = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    });
    animation1.opacity(1).step();
    animation.opacity(0).step();
    this.setData({
      searchani:  animation.export(),
      dituani: animation1.export(),
     
    })
  },
  inputshow:function(){
    this.setData({
      dflag:false,
      izindex:1,
      dzindex:0
    })
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    });
    var animation1 = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease'
    });
    animation1.opacity(0).step();
    animation.opacity(1).step();
    this.setData({
      searchani:  animation.export(),
      dituani: animation1.export(),
     
    })
  },

  weatherweekday: function () {
    var that = this;
    wx.request({
      url: 'https://tianqiapi.com/api',
      data: {
        'version': 'v1',
        'appid':'22256322',
        'appsecret':'aBE2s6jT',
      },
      method: 'GET',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        that.setData({
          weatherweek: res.data
        });
      }
    });
  }
})
